package com.zyh.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

//内置的web适配器
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
    @Override

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/admin/**")//过滤的路径
                .excludePathPatterns("/admin")//排除的路径
                .excludePathPatterns("/admin/login");
    }
}
